package com.cjj.service.impl;

import com.cjj.service.TMentalityService;
import com.cjj.vo.MentalityTestVo;
import com.cjj.vo.TBodyTypeVo;
import com.cjj.vo.TMentalityVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.mapper.TMemberMapper;
import com.guigu.mapper.TMentalityResultMapper;
import com.guigu.mapper.TMentalityTestMapper;
import com.guigu.pojo.TMember;
import com.guigu.pojo.TMentalityTest;
import com.guigu.viwe.PageVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class TMentalityServiceImpl implements TMentalityService {
    @Resource
    private TMentalityResultMapper tMentalityResultMapper;

    @Resource
    private TMentalityTestMapper tMentalityTestMapper;

    @Resource
    private TMemberMapper tMemberMapper;

    @Override
    public PageInfo<TMentalityVo> queryMentality(PageVo<TMentalityVo> pageVo) {
        PageHelper.startPage(pageVo.getCurrentPage(), pageVo.getPageSize());
        PageInfo<TMentalityVo> tBodyTypeVoPageInfo = new PageInfo<>(this.tMentalityResultMapper.queryMentality(pageVo.getCondition()));
        return tBodyTypeVoPageInfo;
    }

    //    查询是否以经体检过
    @Override
    public TMentalityVo queryTMentalityIsNull(String fileName) {
        return this.tMentalityResultMapper.queryTMentalityIsNull(fileName);
    }
//查询所有问题的类型
    @Override
    public List<MentalityTestVo> queryOptions() {
        return this.tMentalityTestMapper.queryQuestion();
    }

    @Override
    public int addMentality(Map map) {

        return this.tMentalityResultMapper.addMentality(map);
    }

//根据编号查询会员
    @Override
    public TMember showUpdateRow(String memberId) {
        return this.tMemberMapper.queryTMember(memberId);
    }
    //修改心理评估
    @Override
    public int updateMentality(Map map) {

        return this.tMentalityResultMapper.updateMentality(map);
    }
    //添加人群分类
    @Override
    public int classification(String tmemberId) {
        return this.tMentalityResultMapper.classification(tmemberId);
    }


}
